home *** CD-ROM | disk | FTP | other *** search
/ PD Collection CD 1 / PD Collection CD 1.iso / textual / tex / files / !tex / TeXsource / commontex / h / OTEX < prev    next >
Encoding:
Text File  |  1988-04-26  |  5.5 KB  |  198 lines

  1. /* Modified from original to fit into Acorn 310 */
  2. /*
  3.  *    Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved.
  4.  *    Copying of this file is granted according to the provisions 
  5.  *    specified in the file COPYING which must accompany this file.
  6.  */
  7.  
  8.  
  9. /*
  10.  *              tex.h
  11.  */
  12.  
  13. #include        <stdio.h>
  14. #include        <signal.h>
  15. #include        <time.h>
  16.  
  17. /*
  18.  * constants in the outer block
  19.  */
  20.  
  21. #define NUL                                     '\0'
  22. #define EOLN                            '\n'
  23. #define FALSE                           0
  24. #define TRUE                            1
  25. #define EMPTY                           0
  26.  
  27. #define BUF_SIZE                        5000
  28. #define DVI_BUF_SIZE            1024
  29. #define ERROR_LINE                      78
  30. #define FILE_NAME_SIZE          104
  31. #define FONT_BASE                       0
  32. #define FONT_MAX                        100
  33. #define FONT_MEM_SIZE           25000
  34. #define HALF_BUF                        512
  35. #define HALF_ERROR_LINE         39
  36. #define HASH_SIZE                       3000
  37. #define HASH_PRIME                      2551
  38. #define HYPH_SIZE                       307
  39. #define MAX_IN_OPEN                     15
  40. #define MAX_PRINT_LINE          78
  41. #define MAX_STRINGS                     5400
  42. #define NEST_SIZE                       40
  43. #define PARAM_SIZE                      30
  44. #define POOL_SIZE                       25000
  45. #define SAVE_SIZE                       600
  46. #define STACK_SIZE                      200
  47. #define STRING_VACANCIES        1000
  48. #define TRIE_OP_HASH_SIZE       512
  49. #define TRIE_SIZE                       8000
  50.  
  51. #ifdef INIT
  52.  
  53. #ifdef BIG
  54. #define MEM_BOT                         0
  55. #define MEM_TOP                         27000
  56. #define TOK_BOT                         0
  57. #define TOK_TOP                         37000
  58. #define MEM_MIN                         MEM_BOT
  59. #define MEM_MAX                         MEM_TOP
  60. #define TOK_MIN                         TOK_BOT
  61. #define TOK_MAX                         TOK_TOP
  62. #define MIN_QUARTERWORD         0
  63. #define MAX_QUARTERWORD         255
  64. #define MIN_HALFWORD            0
  65. #define MAX_HALFWORD            655350
  66. #endif
  67.  
  68. #ifdef BIGG
  69. #define MEM_BOT                         0
  70. #define MEM_TOP                         37000
  71. #define TOK_BOT                         0
  72. #define TOK_TOP                         47000
  73. #define MEM_MIN                         MEM_BOT
  74. #define MEM_MAX                         MEM_TOP
  75. #define TOK_MIN                         TOK_BOT
  76. #define TOK_MAX                         TOK_TOP
  77. #define MIN_QUARTERWORD         0
  78. #define MAX_QUARTERWORD         255
  79. #define MIN_HALFWORD            0
  80. #define MAX_HALFWORD            6553500
  81. #endif
  82.  
  83. #else 
  84.  
  85. #ifdef BIG
  86. #define MEM_BOT                         0
  87. #define MEM_TOP                         27000
  88. #define TOK_BOT                         0
  89. #define TOK_TOP                         37000
  90. #define MEM_MIN                         0
  91. #define MEM_MAX                         128000
  92. #define TOK_MIN                         0
  93. #define TOK_MAX                         45000
  94. #define MIN_QUARTERWORD         0
  95. #define MAX_QUARTERWORD         255
  96. #define MIN_HALFWORD            0
  97. #define MAX_HALFWORD            655350
  98. #endif
  99.  
  100. #ifdef BIGG
  101. #define MEM_BOT                         0
  102. #define MEM_TOP                         37000
  103. #define TOK_BOT                         0
  104. #define TOK_TOP                         47000
  105. #define MEM_MIN                         0
  106. #define MEM_MAX                         256000
  107. #define TOK_MIN                         0
  108. #define TOK_MAX                         65000
  109. #define MIN_QUARTERWORD         0
  110. #define MAX_QUARTERWORD         255
  111. #define MIN_HALFWORD            0
  112. #define MAX_HALFWORD            6553500
  113. #endif
  114.  
  115. #endif
  116.  
  117. /*
  118.  *      types in the outer block
  119.  */
  120.  
  121. #define global          extern
  122.  
  123. #define ascii           unsigned char
  124. #define bool            int
  125. #define byte            unsigned char
  126. #define fnt                     int
  127. #define gord            unsigned char
  128. #define gratio          float
  129. #define group           int
  130. #define ptr                     hword
  131. #define sc                      i
  132. #define scal            long 
  133. #define str                     hword
  134. #define val                     long
  135.  
  136. typedef FILE    *word_file;
  137. typedef FILE    *alpha_file;                    
  138. typedef FILE    *byte_file;
  139.  
  140. #define qword                   unsigned char
  141.  
  142. #define hword   unsigned short  /* unsigned long */
  143.  
  144. typedef union { 
  145.         struct { 
  146.                 hword   rh; 
  147.                 hword   lh; 
  148.         } hh1; 
  149.         struct { 
  150.                 hword   rh; 
  151.                 qword   b0; 
  152.                 qword   b1; 
  153.         } hh2; 
  154. } twoh;
  155.  
  156. typedef struct { 
  157.         qword   b0;
  158.         qword   b1;
  159.         qword   b2;
  160.         qword   b3;
  161. } fourq;
  162.  
  163. typedef union { 
  164.         long    i;   
  165.         gratio  gr;  
  166.         twoh    hh;  
  167.         fourq   qqqq;
  168. } mword;
  169.  
  170. /*
  171.  *      variables in the outer block
  172.  */
  173.  
  174. global  char            banner[];
  175. global  int                     ready_already;
  176.  
  177. /*
  178.  *      functions in the outer block
  179.  */
  180.  
  181. int             final_cleanup();
  182. int             close_files_and_terminate();
  183. int             initialize();
  184. bool    decode_args();
  185. int             handle_int();
  186.  
  187. /*
  188.  * some common programming idioms
  189.  */
  190.  
  191. #define incr(i)                         ++(i)
  192. #define decr(i)                         --(i)
  193. #define odd(i)                          ((i) & 1)
  194. #define abs(i)                          ((i) >= 0 ? (i) : -(i))
  195. #define round(x)                        (long) ((x) > 0.0 ? ((x) + 0.5) : ((x) - 0.5))
  196. #define negate(x)                       (x) = -(x)
  197. #define loop                            while (1)
  198.